<?php
/**
 * Reminder
 *
 * PHP version 5
 *
 * @category Model
 * @package  Croogo
 * @version  1.0
 * @author   Tran Van Dung <dungtv@ic-t.info>
 * @license  http://www.opensource.org/licenses/mit-license.php The MIT License
 * @link     http://www.croogo.org
 */
class Reminder extends AppModel {
/**
 * Model name
 *
 * @var string
 * @access public
 */
    public $name = 'Reminder';
/**
 * Behaviors used by the Model
 *
 * @var array
 * @access public
 */
    public $actsAs = array(
        'Encoder',
        'Cached' => array(
            'prefix' => array(
                'reminder_',
            ),
        ),
    );
    
    public function read_reminder($id=0) {
        if((int)$id != 0) {
            $this->query("UPDATE `cc_reminders` SET `status`=1 WHERE `id`=".(int)$id);
            return true;
        } 
        return false;
    }
    
    public function update_reminder() {
        $this->query(
            'UPDATE `cc_reminders`,`cc_paymentschedules`
            SET `cc_reminders`.`status` = `cc_paymentschedules`.`paid`
            WHERE `cc_reminders`.`paymentschedule_id` = `cc_paymentschedules`.`id`'
        );
        return true;
    }
}
?>